package com.yiduo.outpost.ucenter.controller;

import com.yiduo.outpost.core.model.util.WechatUtils;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author yanwen
 * @create 2024/1/25 14:33
 */
@Slf4j
@Controller
@RequestMapping("index")
@Tag(name = "html页面", description = "html页面")
public class IndexController {

	@GetMapping("index")
	public String index() {
		return "homePage";
	}

	@GetMapping("wechat-sign")
	@ResponseBody
	public Map<String, Object> sign(String url) {
		String jsapi_ticket = "Zqqmael1_O_ddyFwCE14BoXDcyvP7GEz8Z7Wr1AxoU84aBXFwb3A5JZcDzV6A8F8hnvCophmZCmJAjrpS76kwQ";
		Map<String, Object> map = new HashMap<>();
		map.put("appId", "wx7fc4a753a1b223c1");
		map.putAll(WechatUtils.sign(jsapi_ticket, url));
		return map;
	}

}
